package com.dw.service.impl;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dw.entity.OrderInfo;
import com.dw.feign.ProductFeign;
import com.dw.mapper.OrderMapper;
import com.dw.service.OrderService;
import net.bytebuddy.implementation.bytecode.Throw;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.beans.Transient;
import java.util.concurrent.CompletableFuture;

/**
* @author deeps
* @description 针对表【order】的数据库操作Service实现
* @createDate 2025-08-16 11:44:32
*/
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo>
    implements OrderService {

    @Autowired
    private ProductFeign productFeign;
    @Override
    public void hello() {
        System.out.println("hello=================");
    }

    @Override
    //@GlobalTransactional
    public void makeOrder()  {
        OrderInfo orderInfo = new OrderInfo();
        orderInfo.setUserId(1);
        orderInfo.setOrderSn("111");
        orderInfo.setOrderStats("1");
        this.save(orderInfo);
        int i = productFeign.reduceProduct();
//        if(i==1){
//            System.out.println("下单成功=================");
//        }else{
//            throw new RuntimeException("下单失败=================");
//        }

    }


}




